export function formatDate(datestr) {
  var datetime = new Date()
  datetime.setTime(datestr)
  var year = datetime.getFullYear()
  var month = datetime.getMonth() + 1
  var date = datetime.getDate()
  if (month < 10) {
    month = '0' + month
  }
  if (date < 10) {
    date = '0' + date
  }
  return year + '-' + month + '-' + date
}

export function formatTime(timestr) {
  var datetime = new Date()
  datetime.setTime(timestr)
  var hour = datetime.getHours()
  var minute = datetime.getMinutes()
  var second = datetime.getSeconds()
  if (hour < 10) {
    hour = '0' + hour
  }
  if (minute < 10) {
    minute = '0' + minute
  }
  if (second < 10) {
    second = '0' + second
  }
  return formatDate(timestr) + ' ' + hour + ':' + minute + ':' + second
}
